//
//  DMLoginAndRegisterRequest.m
//  DistributionMallApp
//
//  Created by Jim huang on 2018/10/29.
//  Copyright © 2018年 JHnoplan. All rights reserved.
//

#import "DMLoginAndRegisterRequest.h"
#import "DMLoginAndRegisterAPI.h"

@implementation DMLoginAndRegisterRequest

/**
 登录
 
 @param phone 手机号码
 @param PWD 密码
 */
-(instancetype)initWithloginPhone:(NSString *)phone PWD:(NSString * )PWD{
    
    if (self = [super initPOSTWithRequestUrl:KLoginURL]) {
        [self.paramsDic setValue:phone forKey:@"phone"];
        [self.paramsDic setValue:PWD forKey:@"password"];
    }
    return self;
    
}

/**
 获取验证码
 
 @param phone 手机号码
 
 */
-(instancetype)initPhoneSMSCodeWithPhone:(NSString *)phone{
    if (self = [super initGETWithRequestUrl:KPhoneSMSCodeURL]) {
        [self.paramsDic setValue:phone forKey:@"phone"];
        [self.paramsDic setValue:@"86" forKey:@"prix"];
        
    }
    return self;
}

/**
 验证验证码
 
 @param phone 手机号
 @param smsCode 验证码
 */
-(instancetype)initCheckSMSCodeWithPhone:(NSString *)phone smsCode:(NSString *)smsCode{
    if (self = [super initGETWithRequestUrl:KCheckSMSCodeURL]) {
        [self.paramsDic setValue:phone forKey:@"phone"];
        [self.paramsDic setValue:smsCode forKey:@"smsCode"];
        
    }
    return self;
    
}

/**
 注册
 
 @param inviteCode 邀请码
 @param phone 手机号
 @param password 密码
 @param smsCode 验证码
 */
-(instancetype)initRegisterWithInviteCode:(NSString *)inviteCode phone:(NSString *)phone password:(NSString *)password smsCode:(NSString *)smsCode{
    if (self = [super initPOSTWithRequestUrl:KRegisterURL]) {
        [self.paramsDic setValue:inviteCode forKey:@"registerRecommendationId"];
        [self.paramsDic setValue:password forKey:@"password"];
        [self.paramsDic setValue:phone forKey:@"phone"];
        [self.paramsDic setValue:smsCode forKey:@"smsCode"];
        
    }
    return self;
}

/**
 忘记密码
 
 @param phone 手机号
 @param passWord 新密码
 @param smsCode 验证码
 */
-(instancetype)initForgetPWDWithPhone:(NSString *)phone passWord:(NSString * )passWord smsCode:(NSString *)smsCode{
    
    if (self = [super initPOSTWithRequestUrl:KForgetPWDURL]) {
        [self.paramsDic setValue:phone forKey:@"phone"];
        [self.paramsDic setValue:passWord forKey:@"password"];
        [self.paramsDic setValue:smsCode forKey:@"smsCode"];
        
    }
    return self;
}

@end
